package cn.qihua.action;

import java.util.List;

import org.apache.struts2.json.annotations.JSON;

import cn.qihua.model.SysOrganization;
import cn.qihua.service.IOrganizationService;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author 米修
 * 
 */

public class ListOrganizationAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -583678066141112787L;
	public String message;
	private boolean success = false;
	private IOrganizationService SysOrganizationService;
	private List<SysOrganization> listSysOrganization;
	private int query;

	public String listSysOrganization() {
		listSysOrganization = SysOrganizationService.findAll();
		if (listSysOrganization != null && listSysOrganization.size() > 0) {
			this.setSuccess(true);
			return SUCCESS;
		}
		this.setSuccess(false);
		return SUCCESS;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public int getQuery() {
		return query;
	}

	public void setQuery(int query) {
		this.query = query;
	}

	@JSON(name = "root")
	public List<SysOrganization> getListSysOrganization() {
		return listSysOrganization;
	}

	public void setListSysOrganization(List<SysOrganization> listSysOrganization) {
		this.listSysOrganization = listSysOrganization;
	}

	public void setSysOrganizationService(
			IOrganizationService sysOrganizationService) {
		SysOrganizationService = sysOrganizationService;
	}
}
